import axios from 'axios';

// 创建axios实例,60秒请求时限
var instance = axios.create({ timeout: 1000 * 60 });
// 设置post请求头
instance.defaults.headers.post['Content-Type'] = 'application/json';

instance.interceptors.request.use((config) => {
  const token = localStorage.getItem('token');
  config.headers.Authorization = `Bearer ${token}`;
  return config;
}, function(error) {
  return Promise.reject(error);
});

export default instance;
